lib/commit: Fix a tmpfile fd leak in static delta processing
authorColin Walters <walters@verbum.org>
Fri, 30 Jun 2017 01:45:26 +0000 (21:45 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 30 Jun 2017 19:48:05 +0000 (19:48 +0000)
commit192e7b888f8cfcf4f02b0b5b6b502e679e91a4a1
treec724d8c2ba86dad10fed314c762579765aea7a6f
parent4273e670eaec12b86a23608deeaf593799306b51
lib/commit: Fix a tmpfile fd leak in static delta processing

I had thought `glnx_link_tmpfile_at()` actually consumed the tmpfile;
it does consume the *path* but not the fd.  In the non-delta path
things were fine since we used the autocleanup.

But the delta code had a tmpfile allocated in its struct that got reused, and
hence leaked the fd. Fix this by making the commit API actually consume the
tmpfile fully, just like the path path.

Closes: #986
Approved by: jlebon
src/libostree/ostree-repo-commit.c